<?php
/*
Copyright 2008, Nathalia


Author:
Nathalia Sautchuk Patrício          (nathalia.sautchuk@gmail.com)

*/
class FinalizarRenderer extends TRepeaterItemRenderer
{
    public function mudarStatus($sender,$param)
    {
        switch($param->CommandName)
        {
            case 'aprovar':
                $status = 1;
                break;
            case 'reprovar':
                $status = 2;
                break;
            case 'pendente':
                $status = 0;
                break;
        }

		$artigoRecord         = ArtigoRecord::finder()->findByArtigoID($param->CommandParameter);
        $artigoRecord->Status = $status;
        
        // saves to the database via Active Record mechanism
		$artigoRecord ->save();

		// redirects the browser to the homepage
		$this->Response->redirect("./index.php?page=Congressos.Finalizar&CongressoID=".$this->Request['CongressoID']);

    }
}

?>
